#include <stdio.h> 
#include <windows.h> 

DWORD WINAPI funA(LPVOID lp) 
{ 
int i=1; 
int sum=0; 

for(i=1;i<=100;i++) 
sum=sum+i; 

printf("a[0] thread print:%d\n",sum); 

return 0; 
} 

DWORD WINAPI funB(LPVOID lp) 
{ 
int i=1; 
int sum=0; 

for(i=1;i<=101;i++) 
sum=sum+i; 

printf("a[1] thread print:%d\n",sum); 

return 0; 
} 


void main() 
{ 
HANDLE a[2]; 
DWORD dwT,dwY; 


a[0]=CreateThread(NULL,0,funA,0,0,&dwT); 
a[1]=CreateThread(NULL,0,funB,0,0,&dwY); 

WaitForMultipleObjects(2,a,TRUE,50000); 